<?php

//Simple FORM demo

include('./uniq.php');

if (isset($_GET['submit'])){
 $id=$_GET['id'];
 if (checkuniq($id)){
  echo('ID is valid, you submitted this text: ');
  echo(htmlspecialchars($_GET['text']));
  echo('<br /><p><small>Try to re-post by reloading this page</small></p>');
  die();
 } else {
  echo('Invalid ID. Possible reasons are: 1. ID fake, 2. Already used ID, 3. Posted from the other IP');
  die(); 
 }
}

?><html>
<head><title>Simple FORM uniqID usage demo</title></head>
<body><h1>Simple FORM uniqID usage demo</h1>
<p>Try to write something into the field below and submit it by pressing appropriate button</p>

<form method="get" action="index.php">

<p><input type="text" name="text" value="Enter some text here" /></p>

<p>
<input type="hidden" name="id" value="<?php echo(getuniq());?>" />
<input type="submit" value="submit" name="submit" />
</p>

</form>

</body></html>